<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form" %>
<%--
  Created by IntelliJ IDEA.
  User: corcutt
  Date: Mar 18, 2009
  Time: 8:44:32 PM
  To change this template use File | Settings | File Templates.
--%>

<html>
<head><title>My Events</title>
</head>
<script LANGUAGE="JavaScript">
    <!--
    // Nannette Thacker http://www.shiningstar.net
    function confirmDeleteEvent()
    {
        var agree = confirm("Are you sure you wish to delete the event?");
        if (agree)
            return true;
        else
            return false;
    }
    // -->
</script>
<body onload="disableLink('myEvents')">
<%@ include file="header.jspf" %>
<h3>These Are The Four-H Events You Created.</h3>

<c:if test="${empty events}">
    You have no Events created. <a href="createEvent">Create one.</a>
</c:if>
<c:if test="${not empty events}">
    <p align="right">
        <a href="createEvent">Add a new event.</a>
    </p>
    <table border="1" width="100%">
        <tr>
            <%@ include file="eventsListTableHeader.jspf" %>
            <td BGCOLOR="limegreen"></td>
        </tr>
        <c:forEach var="event" items="${events}">
            <tr>
                <%@ include file="eventsListTable.jspf" %>
                <td>
                    <table>
                        <tr>
                            <td valign="top">
                                <form method="GET" action="<c:url value="editEvent"/>" name="editEvent">
                                    <input type="hidden" name="eventID" value="${event.id}"/>

                                    <p class="submit"><input type="submit" value="Edit Event"/></p>
                                </form>
                            </td>
                        </tr>
                        <tr>
                            <td valign="top">
                                <form method="GET" action="<c:url value="deleteEvent"/>" name="deleteEvent">
                                    <input type="hidden" name="eventID" value="${event.id}"/>

                                    <p class="submit"><input type="submit" value="Delete Event"
                                                             onClick="return confirmDeleteEvent()"/></p>
                                </form>
                            </td>
                        </tr>
                        <tr>
                            <td valign="top">
                                <form method="GET" action="<c:url value="createPosition"/>" name="createPosition">
                                    <input type="hidden" name="eventID" value="${event.id}"/>

                                    <p class="submit"><input type="submit" value="Add Position"/></p>
                                </form>
                            </td>
                        </tr>
                    </table>
                </td>
            </tr>
        </c:forEach>
    </table>
</c:if>

<%@ include file="footer.jspf" %>

</body>
</html>